package cn.bytepulse.web.admin.controller;

import cn.bytepulse.annotation.Log;
import cn.bytepulse.pojo.AjaxResult;
import cn.bytepulse.web.admin.service.SystemInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

/**
 * @author jiejiebiezheyang
 * @since 2024-07-12 10:00
 */

@Tag(name = "管理-系统信息")
@RestController
@RequestMapping("/systemInfo")
@RequiredArgsConstructor
public class SystemInfoController {

    private final SystemInfoService systemInfoService;

    @GetMapping("/fetch")
    @Operation(summary = "系统信息")
    @Log(value = "管理-系统信息-系统信息", persist = true)
    @PreAuthorize("hasAnyAuthority('system:info:query')")
    public AjaxResult fetch() throws UnknownHostException {
        return systemInfoService.fetch();
    }
}
